<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
 <%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">
<title>拍卖预展详细信息</title>
<link href="../style/css_member.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/common.js"></script>
<script src="../js/artDialog.js?skin=gray"></script>
<script src="../js/artDialog.iframeTools.js"></script>
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>
<script type="text/javascript">

$(function(){

	$("a[name='addPaintingHref']").click(function(){
		art.dialog({content: document.getElementById('uploadImageDiv'),title:'上传画册图片',width:500,height:350,lock:true},false);
    });
    
	$("a[name='modifyHref']").click(function(){
		var imageid = $(this).attr("title");
		$("#imageId_hidden").val(imageid);
		art.dialog({content: document.getElementById('modifyImageDiv'),title:'修改画册图片',width:500,height:350,lock:true},false);
    });
    
	 m1('m1_004');
});

	/**********提交前检查表单*****************/
	function checkForm(){

		var name = $.trim($("#name").val());
		if( name  ==  ""){
			$("#name").focus();
			 alert("拍卖会名称不能为空。");
			 return false;
		}

		var planningUnit =  $.trim($("#planningUnit").val());
		if( planningUnit  ==  ""){
			$("#planningUnit").val("");
			$("#planningUnit").focus();
			alert("策展单位不能为空。");
			return false;
		}

		var picImage = $("#picImage").val();
		if( picImage == "" ){
			alert("请上传拍卖画册封面图片");
			return false;
		}

		var totalCount =  $.trim($("#totalCount").val());
		if( totalCount  !=  "" &&  !IsInt(totalCount)){
			$("#totalCount").val("");
			$("#totalCount").focus();
			alert("作品数量不合法。");
			return false;
		}

		var beginningTime =  $.trim($("#beginningTime").val());
		if( beginningTime  ==  ""){
			alert("请填写开拍时间。");
			return false;
		}

		var province_id =  $("#provinceInfoSelect").val();
		if( province_id  ==  ""){
			alert("请选择开拍地点。");
			return false;
		}
		
		if(window.confirm("确认提交？")){
			$("#auctionForm").submit();
		}
	}

	function submitForm(){

		var myFile = $("#myFile").val();
		if (/^.+.(gif|jpg|bmp|jpeg|png)$/i.test(myFile)) {
		}else{
			alert("只支持gif,jpg,bmp,jpeg,png格式图片.");
			return false;
		}

		$("#fileForm").submit();
	}

	/***修改图片**/
	function modifyImage(){

		var myFile = $("#modifyFile").val();
		if (/^.+.(gif|jpg|bmp|jpeg|png)$/i.test(myFile)) {
		}else{
			alert("只支持gif,jpg,bmp,jpeg,png格式图片.");
			return false;
		}

		$("#modifyFileForm").submit();
	}

	/**修改拍卖预展基本信息 **/
	function modify(id){
		art.dialog.open('${ctx}/auction/auctionAction!modifyPrepare.do?auction.id='+id,{title:'修改拍卖预展资料',width:820,height:550,lock:true},false);
	}

	/******改变上传状态 *****/
	function changeState(imageid,status){
		var id = '${auction.id }';
		if(status == '2'){
			if (window.confirm("确认删除此图片？")) {
				window.location.href = "${ctx}/auction/auctionAction!deleteImage.do?imageId="+imageid+"&operateStr="+status+"&id="+id;
			}
		}else{
			$.ajax( {
				type : "POST",
				url : "${ctx}/auction/auctionAction!deleteImage.do?imageId="+imageid+"&operateStr="+status+"&id="+id,
				timeout : 6000,
				async : false, //ajax同步
				success : function(data, textStatus) {
					if(data == '0000'){
						window.location.reload(true);
					}
				}
			});
		}
	}

	function showNextPagePic_auction(flag){

		var totalPages = document.getElementById("totalPages_Hidden").value;
		var cur_No = document.getElementById("curPage").value;

		if(totalPages == "" || cur_No == ""){
			return ;
		}
		
		if(flag>0){
			cur_No = parseInt(cur_No) + 1;
			var total_len = '${fn:length(page.result)}';
			if(parseInt(total_len) == 20){
				if(cur_No <= parseInt(totalPages)+1){
					document.getElementById("curPage").value = cur_No;
				}else{
					cur_No = totalPages;
				}
			}
			else if(parseInt(total_len) < 20){
				if(cur_No <= parseInt(totalPages)){
					document.getElementById("curPage").value = cur_No;
				}else{
					cur_No = totalPages;
				}
			}
		}else{
			cur_No = parseInt(cur_No) - 1;
			if(cur_No > 0 ){
				document.getElementById("curPage").value = cur_No;
			}else{
				cur_No = 1;
			}
		}
		
		var x = document.forms[0];
		x.submit();
	}
		
</script>
</head>

<body>

<!-- 页面头部  -->
<jsp:include page="/commons/head_member.jsp"></jsp:include>

<form action="${ctx }/auction/auctionAction!listImagesByAuction.do?auction_Id=${auction.id}" method="post" id="auctionForm" name="auctionForm">
<table align="center" width="960" border="0" cellspacing="0" cellpadding="0" class="tbl_border_top">
          <tr>
            <td>&nbsp;</td>
            <td><div align="center" class="bt14A">拍卖预展资料</div></td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span> 拍卖会名称：</td>
            <td class="bt14A">${auction.name }</td>
            <td width="198" rowspan="8" valign="top" class="bt14A" align="left">
              <table width="165" height="217" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC">
                <tr>
                  <td bgcolor="#FFFFFF">
                  	<div id="photoTd" style="width: 165px;height: 217px;vertical-align: middle;text-align: center;overflow: hidden;">
                  		<img src="${auction.imagepath}">
                  	</div>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span> 策划展单位：</td>
            <td class="bt14A">${auction.planningUnit }</td>
          </tr>
          <tr>
            <td class="bt14A" align="right">封面拍品名称：</td>
            <td class="bt14A">${auction.coverName }</td>
          </tr>
          <tr>
            <td class="bt14A" align="right">参展作品数量：</td>
            <td class="bt14A">${auction.totalCount }</td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span> 开拍时间：</td>
            <td class="bt14A"><fmt:formatDate value='${auction.beginningTime }' pattern='yyyy-MM-dd HH:mm'/></td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span> 开拍地点：</td>
            <td class="bt14A">${auction.provinceInfo.name }${auction.cityInfo.name }${auction.address }
            </td>
          </tr>
          <tr>
            <td class="bt14A" align="right">联系人：</td>
            <td class="bt14A">${auction.contact }</td>
          </tr>
          <tr>
            <td class="bt14A" align="right">咨询电话：</td>
            <td class="bt14A">${auction.tel }
            	<!-- 隐藏域 begin -->
		            <input name="auction.id" type="hidden"  id="picImage" value="${auction.id }">
		            <input name="auction.imageInfo.id" type="hidden"  id="picImage" value="${auction.imageInfo.id }">
		        <!-- 隐藏域 end --> 
            </td>
          </tr>
          <tr>
            <td width="166"></td>
            <td width="539" class="nw12a"><a href="javascript:modify(${auction.id });"><img border="0" src="../images/an41.gif" width="106" height="31" style="cursor: pointer"/></a></td>
          </tr>
  </table>

<%@ include file="/member/add_auction_fragment.jsp" %>
  <!-- 隐藏域 begin  -->
		<input type="hidden" value="<s:property value="page.pageCount" />" name="totalPages_Hidden" id="totalPages_Hidden" />
		<input type="hidden" value="<s:property value="page.pageNo" />" name="curPage" id="curPage" /> 
  <!-- 隐藏域 end -->       
</form>

<!--  上传画册图片div begin -->
<div id="uploadImageDiv" style="width: 480px;display: none;vertical-align: top">
<s:fielderror cssStyle="color:red;font-size:14px;font-family:宋体"/>
<form action="${ctx }/auction/fileUpload.do?id=${auction.id }" method="post"  id="fileForm" enctype="multipart/form-data" target="_top">
	<table width="480" align="center" cellpadding="0" cellspacing="0" border="0" style="font-family: 宋体;font-size: 14px;">
		<tr>
			<td height="30" width="30%" align="right">图片文件：</td>
			<td><input type="file" name="myFile" id="myFile"/></td>
		</tr>
		<tr><td align="right" height="30" >是否为索引目录：</td>
			<td><input type="radio" name="indexFlag" value="yes"/>是
				<input type="radio" name="indexFlag" value="no" checked="checked"/>否
			</td>
		</tr>
		<tr><td align="right" height="30" >图片名称：</td>
		<td><input type="text" name="memo" id="pic_memo"/>
			<input type="hidden" value="<s:property value="page.pageNo" />" name="curPage"/>
		</td>
		</tr>
		<tr><td height="35"></td><td><input type="button" value="上传" onclick="submitForm()"/></td></tr>
	</table>
</form>
</div>
<!--  上传画册图片div end -->


<!--  修改画册图片div begin -->
<div id="modifyImageDiv" style="width: 480px;display: none;vertical-align: top">
	<s:fielderror cssStyle="color:red;font-size:14px;font-family:宋体"/>
	<form action="${ctx }/auction/auctionAction!modifyImages.do?id=${auction.id }" method="post"  id="modifyFileForm" enctype="multipart/form-data">
		<table width="480" align="center" cellpadding="0" cellspacing="0" border="0" style="font-family: 宋体;font-size: 14px;">
			<tr>
				<td height="30" width="30%" align="right">图片文件：</td>
				<td><input type="file" name="myFile" id="modifyFile"/></td>
			</tr>
			<tr><td align="right" height="30">是否为索引目录：</td>
				<td><input type="radio" name="indexFlag" value="yes"/>是
					<input type="radio" name="indexFlag" value="no" checked="checked"/>否
				</td>
			</tr>
			<tr><td align="right" height="30">图片名称：</td><td><input type="text" name="memo" id="pic_memo"/></td></tr>
			<tr><td height="35"><input type="hidden" name="imageId" value="" id="imageId_hidden"/>
				<input type="hidden" value="<s:property value="page.pageNo" />" name="curPage"/>
			</td>
			<td><input type="button" value="上传" onclick="modifyImage()"/></td></tr>
		</table>
	</form>
</div>
<!--   修改画册图片div end -->

<jsp:include page="/commons/foot_member.jsp"></jsp:include>

</body>
</html>